import request from '@/utils/request'
import requestSSO from '@/utils/request-sso'

/**
 * 查询所有用户信息
 */
export function getUserList(data) {
  return request({
    url: `mfauth/sysUser/list`,
    method: 'post',
    data
  })
}
//  查询用户列表
export function getUserListPage(data,pageNum,pageSize) {
  return requestSSO({
    url: `/api/v1/sysUser/list?page=${pageNum}&pageSize=${pageSize}`,
    method: 'post',
    data
  })
}

// 新增用户信息
export function setUserInfo(data) {
  return requestSSO({
    url: '/api/v1/sysUser/insert',
    method: 'post',
    data
  })
}

// 修改密码, 记录ID带在URL上
export function changeUserPassword(data, id) {
  return requestSSO({
    url: `/api/v1/sysUser/password/change/${id}`,
    method: 'post',
    data
  })
}

// 重置密码
export function resetUserPassword(data, id) {
  return requestSSO({
    url: `/api/v1/sysUser/password/reset/${id}`,
    method: 'post',
    data
  })
}

// 冻结账号
export function freezeUserAccount(id) {
  return requestSSO({
    url: `/api/v1/sysUser/freeze/${id}`,
    method: 'get',
  })
}

//  恢复账号
export function restoreUserAccount(id) {
  return requestSSO({
    url: `/api/v1/sysUser/restore/${id}`,
    method: 'get',
  })
}

//  更新用户邮箱地址
export function bindUserLoginName(data) {
  return requestSSO({
    url: `/api/v1/sysUser/bind/loginName`,
    method: 'POST',
    data
  })
}

//  更新用户手机号
export function bindUserMobile(data) {
  return requestSSO({
    url: `/api/v1/sysUser/bind/mobile`,
    method: 'POST',
    data
  })
}
